var mongoose = require("mongoose");

//评论表(comment)

var commentSchema = new mongoose.Schema({
  userid: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "user_login",
    required: true
  }, //用户id
  articleid: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "article",
    required: true
  }, //文章id
  aeticletype: {
    type: String,
    required: true
  }, //文章类型
  content: {
    type: String,
    required: true
  }, //评论内容
  release_time: {
    type: Date,
    default: new Date()
  }, //发布时间
  praise: {
    type: Array,
    default: []
  }, //赞量
});

module.exports = mongoose.model("comment", commentSchema);